﻿using System;
using Aeon.Framework.Objects;

namespace Aeon.Framework
{
   
/// <summary>
/// Class for the definition of font face style parameters.
/// 
/// </summary>
public sealed class FontType : IEquatable<FontType>
    {
    // --- Attributes:
    
    private IColor color;           // Face color.
    private String face;            // Face path.
    private UInt16 size;            // Face size.
    private UInt16 dpi;             // Face dpi.
    
    // --- Properties:
    
    public IColor Color { get { return(color); } set { color = value; } }

    public String Face { get { return(face); } }
    public UInt16 Size { get { return(size); } }
    public UInt16 DPI { get { return(dpi); } }
        
    // --- Constructor:
    
    public FontType(String face, UInt16 size, IColor color)
        {
        dpi = 196;
        
        this.face = face;
        this.size = size;
        this.color = color;
        }
        
    // --- Comparison:

    private bool compare(FontType obj)
        {
        bool equals;
        
        if (face == obj.Face && size == obj.Size && color.Equals(obj.color) && dpi == obj.DPI) equals = true;
        else equals = false;
        
        return(equals);
        }

    public override int GetHashCode()
        {

        return(color.GetHashCode()^face.GetHashCode()^size.GetHashCode()^dpi.GetHashCode());
        }

    public override bool Equals(Object obj)
        {
        bool equal = false;

        FontType f = obj as FontType;
        if (f != null) { equal = compare(f); }

        return(equal); 
        }

    public bool Equals(FontType f) 
        {
        bool equal = false;

        if (f != null) { equal = compare(f); }

        return(equal);
        }
    }


}
